/**
 * ===========================================
 * Project: cy-qbadmin
 * ===========================================
 * Package: com.cyou.qb.admin.service
 * 
 * Copyright (c) 2012, CYOU All Rights Reserved.
 * ===========================================
 */
package com.cyou.qb.common.service;

import java.util.List;

import com.cyou.nad.datastore.DataList;
import com.cyou.nad.datastore.query.JdbcPage;
import com.cyou.qb.common.domain.Award;
import com.cyou.qb.common.domain.AwardDetail;
import com.cyou.qb.common.domain.FrontAward;
import com.cyou.qb.service.BaseService;

/**
 * <p>ActivityService</p>
 * <p>
 * Description:奖品管理service
 * </p>
 *
 * @author lidongwei
 * @version 
 * @since 2012-9-23
 */
public interface AwardService extends BaseService {

	/**
	 * <p>奖品查询</p>
	 * 根据活动ID获得所有奖品<br>
	 * <b>按时间中奖降序排列</b>
	 * @author zoudongchao
	 * @param activeId 活动ID
	 * @return
	 */
	public List<Award> findAwards(int activeId);

	/**
	 * <p>奖品查询</p>
	 * 根据奖品ID获得唯一奖品
	 * @author zoudongchao
	 * @param awardId 奖品ID
	 * @return
	 */
	public Award findAward(int awardId);

	/**
	 * <p>奖品更新</p>
	 * 更新奖品库存
	 * @author zoudongchao
	 * @param award 奖品实体Award
	 */
	public void updateAwardCurrNum(Award award);

	/**
	 * <p>奖品明细查询</p>
	 * 根据奖品ID获得奖品明细
	 * @param awardId 奖品ID
	 * @return
	 */
	public AwardDetail findAwardDetail(int awardId);

	/**
	 * Description
	 * @author lidongwei 添加
	 * @param activityId 
	 * @param adminId 
	 * @param awardImageUrl 
	 * @param memo 
	 * @param useAdd 
	 * @param minitype 
	 * @param type 
	 * @param awardNmae 
	 * @throws Exception 
	 * @since 2012-9-19
	 */
	public int saveOneAward(String awardNmae, String type, String minitype, String useAdd, String memo,
			String awardImageUrl, int adminId, String activityId);

	/**
	 * Description 删除
	 * @author lidongwei
	 * @throws Exception 
	 * @since 2012-9-19
	 */
	public int removeAward(String awardId) throws Exception;

	/**
	 * Description 根据活动id获取奖品
	 * @author lidongwei
	 * @since 2012-9-23
	 */
	public JdbcPage pageQueryAward(String activeId, int pageNo, int pageSize);

	/**
	 * Description 修改一个奖品
	 * @author lidongwei
	 * @throws Exception 
	 * @since 2012-10-9
	 */
	public void updateOnewAward(String awardId, String awardName, String type, String minitype, String useAdd,
			String memo, String awardImageUrl, int adminId) throws Exception;

	/**
	 * Description 获取可用GB数
	 * @author lidongwei
	 * @since 2012-10-9
	 */
	public int findSurplusGb(String awardId);

	/**
	 * 查询 活动的奖品数量
	 * 此方法会使用cache，所以在循环中使用不会影响效率
	 * @param activeId  活动id
	 * @return
	 */
	public int findActiveMaxAwardNum(int activeId);

	/**
	 * Description 实体奖品入库
	 * @author lidongwei
	 * @throws Exception 
	 * @since 2012-10-10
	 */
	public void updateStoreEntity(String awardId, String awardNum) throws Exception;

	/**
	 * Description 经验值入库
	 * @author lidongwei
	 * @throws Exception 
	 * @since 2012-10-10
	 */
	public void updateStoreExperience(String awardId, String experienceNum, String experienceAmount) throws Exception;

	/**
	 * Description  gb入库
	 * @author lidongwei
	 * @throws Exception 
	 * @since 2012-10-10
	 */
	public void updateStoreGb(String awardId, String gbnum, String gbAmount) throws Exception;

	/**
	 * Description 将虚拟奖品保存到数据库：t_award_detail
	 * @author lidongwei
	 * @param awardId 
	 * @throws Exception 
	 * @since 2012-10-10
	 */
	public int saveAwardDetails(String[] txtArray, String awardId) throws Exception;

	/**
	 * <p>更新一条奖品明细记录</p>
	 * @author zoudongchao
	 * @param awardDetail
	 * 			奖品明细实体
	 * @return
	 * @throws Exception
	 */
	public int updateOneAwardDetail(AwardDetail awardDetail) throws Exception;

	/**
	 * Description 获取奖品当前剩余数量
	 * @author lidongwei
	 * @return 
	 * @throws Exception 
	 * @since 2012-10-11
	 */
	public int findCurrNum(String awardId) throws Exception;
	
	/**
	 * 
	 * Description　根据活动ｉｄ获取奖品
	 * @author lidongwei
	 * @since 2012-10-30
	 */

	public DataList findAwardsByActId(String activeId);

	/**
	 * Description 追加奖品
	 * @author lidongwei
	 * @throws Exception 
	 * @since 2012-10-15
	 */
	public void updateAddToAward(String awardId, String addToNum) throws Exception;

	/**
	 * Description  分页查询实物奖品信息----用于奖品明细
	 * @author lidongwei
	 * @param userId 
	 * @param userNick 
	 * @since 2012-10-16
	 */
	public JdbcPage pageQueryEntity(String awardId, String userNick, String userId, int pageNo, int pageSize);

	/**
	 * Description 分页查询虚拟奖品信息---用于奖品明细
	 * @author lidongwei
	 * @param vWin 
	 * @param vUserId 
	 * @param vUserNick 
	 * @since 2012-10-16
	 */
	public JdbcPage pageQueryVirtual(String awardId, String vUserNick, String vUserId, String vWin, int pageNo,
			int pageSize);

	/**
	 * Description 分页查询查询G币和经验值信息---用于奖品明细
	 * @author lidongwei
	 * @param userId 
	 * @param userNick 
	 * @since 2012-10-16
	 */
	public JdbcPage pageQueryGBAndExp(String awardId, String userNick, String userId, int pageNo, int pageSize);

	/**
	 * Description 修改非虚拟奖品的奖品当前数量以及最大数量
	 * @author lidongwei
	 * @throws Exception 
	 * @since 2012-10-16
	 */
	public void updateNoVirNum(String awardId, String newCurrNum) throws Exception;

	/**
	 * Description 删除虚拟奖品
	 * @author lidongwei
	 * @param awardId 
	 * @throws Exception 
	 * @since 2012-10-16
	 */
	public void removeVirtual(List<String> virtualIdList, String awardId) throws Exception;
	
	/**
	 * 
	 * Description 查找前台显示的奖品list
	 * @author lidongwei
	 * @since 2012-10-30
	 */

	public List<FrontAward> findAwardList() throws Exception;

	/**
	 * Description 根据活动id，获取当前活动已经配置的尾数
	 * @author lidongwei
	 * @since 2012-10-30
	 */
	public List<Integer> findNumWinListByActId(String activeId);

}
